<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
                xmlns:h="http://xmlns.jcp.org/jsf/html"
                xmlns:f="http://xmlns.jcp.org/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/WEB-INF/template.xhtml">

    <ui:define name="title">
        Schedule <span class="subitem">Basic</span>
    </ui:define>

    <ui:define name="description">
        Schedule provides an Outlook, iCal like JSF component to manage events which is based on FullCalendar. Schedule is highly customizable featuring various views (month, day, week), built-in I18N, drag-drop, resize, customizable event dialog, ajax listeners for every user interaction and more.
    </ui:define>

    <ui:param name="documentationLink" value="/components/schedule"/>
    <ui:param name="widgetLink" value="Schedule-1"/>

    <ui:define name="implementation">
        <div class="card">
            <h:form>
                <p:growl id="messages" showDetail="true"/>

                <p:schedule id="schedule" value="#{scheduleJava8View.eventModel}" widgetVar="myschedule"
                            timeZone="#{scheduleJava8View.serverTimeZone}" clientTimeZone="#{scheduleJava8View.serverTimeZone}">
                    <p:ajax event="dateSelect" listener="#{scheduleJava8View.onDateSelect}" update="eventDetails"
                            oncomplete="PF('eventDialog').show();"/>
                    <p:ajax event="eventSelect" listener="#{scheduleJava8View.onEventSelect}" update="eventDetails"
                            oncomplete="PF('eventDialog').show();"/>
                    <p:ajax event="eventMove" listener="#{scheduleJava8View.onEventMove}" update="messages"/>
                    <p:ajax event="eventResize" listener="#{scheduleJava8View.onEventResize}" update="messages"/>
                </p:schedule>

                <p:dialog widgetVar="eventDialog" header="Event Details" showEffect="fade" hideEffect="fade">
                    <h:panelGrid id="eventDetails" columns="2" cellpadding="7">
                        <p:outputLabel for="title" value="Titles" styleClass="font-bold"/>
                        <p:inputText id="title" value="#{scheduleJava8View.event.title}" required="true"/>

                        <p:outputLabel for="from" value="From" styleClass="font-bold"/>
                        <p:datePicker id="from" value="#{scheduleJava8View.event.startDate}" pattern="dd/MM/yyyy"
                                      showTime="true" appendTo="@(body)"/>

                        <p:outputLabel for="to" value="To" styleClass="font-bold"/>
                        <p:datePicker id="to" value="#{scheduleJava8View.event.endDate}" pattern="dd/MM/yyyy"
                                      showTime="true" appendTo="@(body)"/>

                        <p:outputLabel for="allDay" value="All Day" styleClass="font-bold"/>
                        <h:selectBooleanCheckbox id="allDay" value="#{scheduleJava8View.event.allDay}"/>
                    </h:panelGrid>

                    <div class="flex justify-content-between mt-3">
                        <p:commandButton type="reset" value="Reset" styleClass="font-bold ui-button-outlined"/>
                        <p:commandButton id="addButton" value="Save" action="#{scheduleJava8View.addEvent}" 
                                    oncomplete="PF('myschedule').update();PF('eventDialog').hide();"/>
                    </div>               
                </p:dialog>
            </h:form>
        </div>
    </ui:define>

</ui:composition>
